package org.phiintegration.concurrent;

import java.util.HashSet;
import java.util.Set;

//Sharing object concept: Visibility, Publications & Escapes
//Thread confinement, Immutability, Safe publication

/*An object is immutable if:

	Its state cannot be modified after construction;

	All its flelds are final;[12] and

	It is properly constructed (the this reference does not escape during construction).
	 
*/
@Immutable
public final class ThreeStooges {
    private final Set<String> stooges = new HashSet<String>();

    public ThreeStooges() {
        stooges.add("Moe");
        stooges.add("Larry");
        stooges.add("Curly");
    }

    public boolean isStooge(String name) {
        return stooges.contains(name);
    }
}


